#include "ALL.h"

#define FOSC            33177600UL
#define BRT             (65536 - 9)


char wptr;
u8 uart_buffer[73];//012 #@ 3-71 dat&color 72 light_wait



void UartIsr() interrupt 4
{
	if (RI)
	{
		RI = 0;
		uart_buffer[wptr] = SBUF;
		if(uart_buffer[wptr]==0x31&&uart_buffer[wptr-1]==0x08&&uart_buffer[wptr-2]==0x98)
		{
			wptr=2;
		}
		wptr++;
		if(wptr==73)
			wptr=0;
	}
}

void uart_init()
{
	SCON = 0x50;
	TMOD=0X00;
	TL1 = BRT;
	TH1 = BRT >> 8;
	TR1=1;
	AUXR = 0x40;
	wptr = 0x00;
	ES = 1;
	EA = 1;
}



